<?php echo $this->input;?>
<?php if(count($this->msg)):?>
<table>
    <tr>
        <th></th>
        <th></th>
        <th><a href="<?php if($this->dir != 'desc' && $this->sort_by == 'user_name'):
                                                                            echo '/index/index/sort_by/user_name/dir/desc';?>">Name <?php echo $this->arrow;?></a></th>
                    <?php elseif($this->dir != 'asc' && $this->sort_by == 'user_name'):
                                                                            echo '/index/index/sort_by/user_name/dir/asc';?>">Name <?php echo $this->arrow;?></a></th>
                    <?php else: 
                                                                            echo '/index/index/sort_by/user_name/dir/asc';?>">Name</a></th>
                    <?php endif;?>
        <th><a href="<?php if($this->dir != 'desc' && $this->sort_by == 'email'): 
                                                                            echo '/index/index/sort_by/email/dir/desc';?>">e-mail <?php echo $this->arrow;?></a></th>
                    <?php elseif($this->dir != 'asc' && $this->sort_by == 'email'):
                                                                            echo '/index/index/sort_by/email/dir/asc';?>">e-mail <?php echo $this->arrow;?></a></th>
                    <?php else: 
                                                                            echo '/index/index/sort_by/email/dir/asc';?>">e-mail </a></th>
                    <?php endif;?>
        <th><a href="<?php if($this->dir != 'desc' && $this->sort_by == 'dt'): 
                                                                                echo '/index/index/sort_by/dt/dir/desc';?>">date <?php echo $this->arrow;?></a></th>
                    <?php elseif($this->dir != 'asc' && $this->sort_by == 'dt'):
                                                                                echo '/index/index/sort_by/dt/dir/asc';?>">date <?php echo $this->arrow;?></a></th>
                    <?php else:
                                                                                echo '/index/index/sort_by/dt/dir/asc';?>">date </a></th>
                    <?php endif;?>
         <th>text</th>
        <th>browser</th>
        <th>ip</th>
    </tr>
   <?php  foreach($this->msg as $msg): ?>
    <tr>                      
                 <?php if(!empty($msg->img_name)):?>  
            <td>
                <a href="<?php echo $msg->img_uri;?>" rel="lightbox">
                    <img src="<?php echo $msg->img_uri;?>" width="100"></a>
            </td>
                 <?php else:?>
            <td>
                <a href="<?php echo $msg->img_uri;?>" rel="lightbox">
                    <img src="<?php echo $msg->img_uri;?>" width="100"  ></a>
            </td>
                 <?php endif;?>
            <td>
                <?php if(!empty($msg->txt_uri)):?>
                    <a href="<?php echo $msg->txt_uri;?>">
                        <img src="<?php echo $this->txt_uri_icon;?>"  ></a>
                <?php endif;?>
            </td>
            <td><?php echo $msg->user_name;?></td>
            <td><?php echo $msg->email;?></td>
            <td><?php echo date('Y-m-d H:i:s', $msg->dt);?></td>
            <td><?php echo $msg->text;?></td>
            <td><?php echo $msg->browser;?></td>
            <td><?php echo $msg->ip;?></td>
    </tr>
   <?php endforeach;?>
</table>
<?php else: echo 'Сообщений нет';?>
<?php endif;?>